package fr.inserm.umr915.vcfserver.io;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.zip.GZIPInputStream;

import org.springframework.core.io.InputStreamSource;

public class GZIpUrlStreamSource implements InputStreamSource
	{
	private String uri;
	public GZIpUrlStreamSource(String uri)
		{
		this.uri=uri;
		}
	@Override
	public InputStream getInputStream() throws IOException
		{
		URL url=new URL(this.uri);
		URLConnection con=url.openConnection();
		con.setConnectTimeout(120*1000);
		return new GZIPInputStream(con.getInputStream());
		}
	}
